/** 
 * Description:首页分类DAO
 * Date:2013-1-16
 * Author:Along	
*/
package com.community.shopping.dao;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.community.shopping.domain.IndexItem;

public class IndexItemDao extends HibernateDaoSupport{
	private Log log = LogFactory.getLog(IndexItemDao.class);  
	

	public void save(IndexItem indexItem){
		getHibernateTemplate().saveOrUpdate(indexItem);	
		log.debug("-------保存一行indexItem-------");
	}

	public void delete(IndexItem indexItem){		  
		getHibernateTemplate().delete(indexItem);
		log.debug("---------删除一行indexItem-------");
	}
	
	public List<IndexItem> getIndexItem(String hql) {  	
		 String finalsql="from IndexItem where "+hql;
		 return getHibernateTemplate().find(finalsql);
		 }

	public List<IndexItem> getIndexItemByShopId(Integer shopId) {  		
	 return  getIndexItem(" shopId="+shopId);
	 }
	
	public IndexItem getIndexItem(Integer id){
		return getHibernateTemplate().load(IndexItem.class, id);
	}
	
	}

